<template>
  <div>
    <p>登录页</p>
    <input type="text" v-model="model.username">
    <input type="password" v-model="model.password">
    <button type="button" @click="onSubmit">登录</button>
  </div>
</template>

<script>
import { apis,utils } from '../../../../dist'
export default {
  name: 'Login',
  data() {
    return {
      model:{
        username:"18580687918",
        password:"123456",
        grant_type: "password",
        sub_grant_type:"password",
        scope:"all"
      }
    }
  },
  methods:{
    onSubmit(){
      const _this = this;
      apis.obtainAccessToken({...this.model}).then(res=>{
        console.log("res",res)
        utils.auth.storeAuthInfo(res);
        _this.$router.push({name:'Home'})
      })
      .catch(err=>{
        console.log("err",err)
      })
    }
  }
}
</script>

<style lang="less" scoped></style>
